﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace LCS.Domain.Repository
{
    public interface IRepository<TEntity>
    {
        //分页方法记录总数获取
        int TotalCount(Expression<Func<TEntity, bool>> filter = null);

        //分页方法分页获取表中的记录数
        IEnumerable<TEntity> GetPageList(int start, int limit, string sort, string dir,
                                                       Expression<Func<TEntity, bool>> filter = null,
                                                       string includeProperties = "");


        IEnumerable<TEntity> Get(
           Expression<Func<TEntity, bool>> filter = null,
           Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
           string includeProperties = "");



        IQueryable<TEntity> GetQuery(
          Expression<Func<TEntity, bool>> filter = null,
          Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
          string includeProperties = "");




        TEntity GetByID(object id);

        void Insert(TEntity entity);


        void Delete(object id);

        void Delete(TEntity entityToDelete);


        void Update(TEntity entityToUpdate);


        IEnumerable<TEntity> GetWithRawSql(string query, params object[] parameters);

    }
}
